import { request } from './request'

// 获取权限列表
export function getRightsList(type) {
  return request({
    url: `rights/${type}`,
    params: {
      type
    }
  })
}


// 获取角色列表
export function getRolesList() {
  return request({
    url:'/roles'
  })
}

// 添加角色
export function addRolesN(addRuleForm) {
  return request({
    url: 'roles',
    data: addRuleForm,
    method:'post'
  })
}

//获取角色信息
export function getRoleMessage(id) {
  return request({
    url: `roles/${id}`,
    params: {
      id
    }
  })
}

// 编辑角色
export function editRolesN(editForm) {
  return request({
    url: `roles/${editForm.roleId}`,
    data: {
      id: editForm.roleId,
      roleName: editForm.roleName,
      roleDesc:editForm.roleDesc
    },
    method:'put'
  })
}

// 删除角色
export function deleteRole(id) {
  return request({
    url: `roles/${id}`,
    data: {
      id
    },
    method:'delete'
  })
}

